<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $this->title;?></title>
<link rel="stylesheet" href="<?php echo $this->baseUrl;?>/files/admin/css/main.css" />
<script language="javascript" src="<?php echo $this->baseUrl;?>/files/admin/js/jquery.js"></script>
<script language="javascript" src="<?php echo $this->baseUrl;?>/files/admin/js/load.js"></script>
<!--时间选择器-->
<script language="javascript" src="<?php echo $this->baseUrl;?>/files/admin/js/date/calendar.js"></script>
<script language="javascript" src="<?php echo $this->baseUrl;?>/files/admin/js/date/lang/cn_utf8.js"></script>
<script language="javascript" src="<?php echo $this->baseUrl;?>/files/admin/js/date/calendar-setup.js"></script>
<link rel="stylesheet" href="<?php echo $this->baseUrl;?>/files/admin/js/date/calendar-blue.css" />
<!--colorbox-->
<script language="javascript" src="<?php echo $this->baseUrl;?>/files/admin/js/colorbox.jquery/jquery.colorbox.js"></script>
<link href="<?php echo $this->baseUrl;?>/files/admin/js/colorbox.jquery/colorbox2.css" rel="stylesheet" type="text/css"/>

<style>
#search table{ width:500px;}
.event-body{ margin-bottom:10px;}
.event-body table{ border:1px solid #484848; background:#CCCCCC;}
.event-body table .li td{ border-top:1px solid #484848; background:#fff;}
i{ text-decoration: underline; font-style:normal; color:#CC6600; }/*值*/
.event-body span{display:block; float:left; padding-right:10px;}
.event-body span.field{ width:50px;}
.event-body span.field-type{ width:100px;}
.event-loop li { margin-left:24px;}
.event-loop li span{ float:none;padding-left:36px;}
.event-loop li span.loop-times{padding-left:0px;}
</style>
</head>

<body>
	<div id="main">
		<div id="topMenu">
			<div id="navigation">当前位置：日志列表</div>
			<div id="topOtherMenu">
			</div>
		</div>
		<div id="body">
			<div id="search">
			<form id="searchForm" name="searchForm" method="post" action="<?php echo $this->projectUrl(array('action'=>'index'));?>">	
			<table width="500" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="93" align="right">开发环境：</td>
                <td width="168" align="left">
				<select name="expType" id="expType">
                    <option value="test" <?php if($this->vars['expType']=='test'){?>selected="selected"<?php }?>>测试</option>
                </select></td>
                <td width="239" ><span id="sp_expType">*</span></td>
              </tr>
              <tr>
                <td align="right">日期选择：</td>
                <td align="left"><input name="startTime" type="text" class="input" id="startTime" size="10" value="<?php echo $this->vars['startTime'];?>" />
                  <script type="text/javascript">Calendar.setup({"ifFormat":"%Y-%m-%d","firstDay":0,"showsTime":true,"showOthers":false,"timeFormat":24,"inputField":"startTime","button":"startTime"});</script></td>
                <td ><span id="sp_startTime">*</span></td>
              </tr>
              <tr>
                <td align="right">操作系统：</td>
                <td align="left">
				<select name="osName" id="osName">
                    <option value="">请选择</option>
                    <?php foreach($this->osNameRows as $key=>$row) {?>
                    <option value="<?php echo $row[0];?>" <?php if($this->vars['osName']==$row[0]){?>selected="selected"<?php }?>><?php echo $row[1];?></option>
                    <?php }?>
                </select></td>
                <td ><span id="sp_osName">*</span></td>
              </tr>
              <tr>
                <td align="right">userSign：</td>
                <td align="left"><input type="text" name="userSign" id="userSign" value="<?php echo $this->vars['userSign'];?>" class="input"/></td>
                <td ><span id="sp_userSign"></span></td>
              </tr>
              
			  <tr>
                <td align="right">排序方式：</td>
                <td align="left"><select name="eventSort" id="eventSort">
                    <option value="ASC" <?php if($this->vars['eventSort']=='ASC'){?>selected="selected"<?php }?>>升序</option>
					<option value="DESC" <?php if($this->vars['eventSort']=='DESC'){?>selected="selected"<?php }?>>降序</option>
                </select></td>
                <td ><span id="sp_eventType"></span></td>
              </tr>
			   <tr>
                <td align="right">显示记录：</td>
                <td align="left"><input type="text" name="pageSize" id="pageSize" size="4" value="<?php echo $this->vars['pageSize'] ? $this->vars['pageSize'] : 30;?>" class="input"/></td>
                <td ><span id="sp_pageSize"></span></td>
              </tr>
			  <tr>
                <td align="right">自动刷新：</td>
                <td align="left"><input name="isAuto" type="checkbox" value="1" <?php echo $this->vars['isAuto'] == 1 ? ' checked="checked"' : '';?>/> 默认刷新时间2s</td>
                <td ></td>
              </tr>
              <tr>
                <td align="right">&nbsp;</td>
                <td align="left"><input type="hidden" name="dateType" id="dateType" value="<?php echo $this->vars['dateType'];?>" />
                    <input type="hidden" name="doType" id="doType" value="<?php echo $this->vars['doType'];?>" />
                    <input name="search" type="button" id="search2" value="查找" class="button" onclick="selData('<?php echo $this->projectUrl(array('action'=>'index')) ;?>',6,<?php echo $this->vars['doType'];?>);"/>
                </td>
              </tr>
            </table>
			</form>
			</div>
			<div id="content" style="padding-top:5px;">
					
<?php foreach($this->rows as $row) {?>
						<div class="event-body">
							<table>
								<tr class="subject">
									<td>事件日期</td>
									<td>userSign</td>
									<td>ip</td>
									<td>eventId</td>
									<td>eventName</td>
									<td>productCode</td>
									<td>osName</td>
									<td>sourceId</td>
									<td>sourceSubId</td>
								</tr>
								<tr>
									<td><?php echo !empty($row['eventTime']) ? date('Y-m-d H:i:s',intval($row['eventTime']/1000))."({$row['eventTime']}ms)" : '&nbsp;' ;?></td>
									<td><?php echo !empty($row['userSign']) ? $row['userSign'] : '&nbsp;';?></td>
									<td><?php echo !empty($row['ip']) ? $row['ip'] : '&nbsp;';?></td>
									<td><?php echo !empty($row['eventId']) ? $row['eventId'] : '&nbsp;';?></td>
									<td><?php echo !empty($row['eventName']) ? $row['eventName'] : '&nbsp;';?></td>
									<td><?php echo !empty($row['productCode']) ? $row['productCode'] : '&nbsp;';?></td>
									<td><?php echo !empty($row['osName']) ? $row['osName'] : '&nbsp;';?></td>
									<td><?php echo !empty($row['sourceId']) ? $row['sourceId'] : '&nbsp;';?></td>
									<td><?php echo !empty($row['sourceSubId']) ? $row['sourceSubId'] : '&nbsp;';?></td>
								</tr>
								<?php 
								$eventFieldRows = $this->eventFieldRows;
								foreach($eventFieldRows[$row['logId']] as $key =>$field) {?>
								<tr class="li">
									<?php if ($field['fieldType']=='K'){//循环 类型?>
									<td colspan="9">
									<span class="field">字段<?php echo $field['fieldSort'];?>#</span><span class="field-type"><?php echo isset($this->fieldTypeRows[$field['fieldType']]['nameNote']) ? $this->fieldTypeRows[$field['fieldType']]['nameNote'] : '';?> (<?php echo $field['fieldType'];?>)</span><span><?php echo $field['fieldName'];?>[<?php echo $field['note'];?>]</span><br/>
									<div class="event-loop">
										<ul>
											<?php
												foreach ($field['loop'] as $val => $fieldLoops){
													//dump($fieldLoops);
													$loopLi ="<span class='loop-times'>{$val}#</span>";
													foreach($fieldLoops as $fieldLoop){
													    $loopLi = $loopLi."<span>{$fieldLoop['fieldName']}({$fieldLoop['note']}):<i>{$fieldLoop['loopValue']}</i></span>";
													}
													echo "<li>{$loopLi}</li>";
												}
											?>
											
										</ul>
									</div>
									</td>
									<?php } else{?>
									<td colspan="9"><span class="field">字段<?php echo $field['fieldSort'];?>#</span> <span class="field-type"><?php echo isset($this->fieldTypeRows[$field['fieldType']]['nameNote']) ? $this->fieldTypeRows[$field['fieldType']]['nameNote'] : '';?> (<?php echo $field['fieldType'];?>)</span><span><?php echo $field['fieldName'];?>[<?php echo $field['note'];?>]:<i><?php echo $field['fieldValue'];?></i></span></td>
									<?php }?>
								</tr>
								<?php }?>
								
							</table>
						</div>
<?php
}
?>
					
					<table class="controlTable">
						<tr>
							<td align="left">
							</td>
							 <td colspan="6" align="right" class="paginator"><?php echo $this->pageString;?></td>
					</tr>
					</table>
			</div>
		</div>
</div>
<script language="javascript">
function selData(action,dateType,doType){
	if($.trim($('#expType').val())==''){
		$('#sp_expType').html("<font color='red'>*请选择开发环境！</font>");
		$("#expType").focus();
		return false;
	}
	if($.trim($('#startTime').val())==''){
		$('#sp_startTime').html("<font color='red'>*请选择日志日期！</font>");
		$("#startTime").focus();
		return false;
	}
	if($.trim($('#osName').val())==''){
		$('#sp_osName').html("<font color='red'>*请选择操作系统！</font>");
		$("#osName").focus();
		return false;
	}
    $('#searchForm').attr('action', action);
	$('#dateType').attr('value', dateType);
	$('#doType').attr('value', doType);
    $('#searchForm').submit();
	
}
<?php if ($this->vars['isAuto'] == 1){?>
//自动刷新
setInterval("autoSubmit()", 2000);
function autoSubmit() {
	$('#searchForm').submit();
}
<?php }?>
</script>
</body>
</html>